﻿using LiteBlog.Common.Entities;
using LiteBlog.Repositories.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LiteBlog.Components.SiteMap
{
    internal class PageProvider : ISiteMapProvider
    {
        private IPageRepository _pageRepo;

        internal PageProvider(IPageRepository pageRepo)
        {
            _pageRepo = pageRepo;
        }
        public IEnumerable<SiteMapUrl> GetSiteMapItems()
        {
            return _pageRepo.GetPages().Select(page => new SiteMapUrl
            {
                Location = "/Page/" + page.FileId,
                LastModifiedTime = DateTime.UtcNow,
                Priority = 1.0F
            });
        }
    }
}
